package cn.dlc.com;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

/*@SpringBootApplication
// 启动eureka client
@EnableEurekaClient
@EnableBinding(Source.class)
public class ProductServerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(ProductServerApplication.class, args);
    }

    // 这个变量不能乱取，只有三个，
    // output，errorChannel，nullChannel
    @Autowired
    private MessageChannel output;

    @Override
    public void run(String... args) throws Exception {
        // 构建消息，发送消息
        output.send(MessageBuilder.withPayload("hello stream").build());
    }
}*/

//第二种发送方式，结合message包中的MsgSender
@SpringBootApplication
@EnableEurekaClient
public class ProductServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ProductServerApplication.class, args);
    }
}
